package com.yyr.spring_boot.modules.common.dao;

import com.yyr.spring_boot.modules.common.entity.ExceptionLog;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface ExceptionLogDao {

    @Select("select * from common_exception_log " +
            "where `path` = #{path} and exception_type = #{exceptionType} limit 1")
    ExceptionLog getELbyPathAndName(
            @Param("path") String path,
            @Param("exceptionType") String exceptionType);

    @Insert("insert into common_exception_log(ip, `path`, class_name, method_name, exception_type, exception_message, creat_date, update_date) " +
            "values(#{ip}, #{path}, #{className}, #{methodName}, #{exceptionType}, #{exceptionMessage}, #{creatDate}, #{updateDate})")
    @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
    void insetExceptionLog(ExceptionLog exceptionLog);
}
